using System;
using DbEntities.Entities;
using NHibernate;
using NHibernate.Criterion;

namespace DataLayer.Repositories
{
    public class SubscribersRepository : BaseRepository<Subscriber, long>, ISubscribersRepository
    {
        public SubscribersRepository(ISession session)
            : base(session)
        {
        }

        #region ISubscribersRepository Members

        public Subscriber FindByInputQueueName(String inputQueueName)
        {
            return Session.CreateCriteria(typeof (Subscriber))
                .Add(Restrictions.Eq("InputQueueName", inputQueueName))
                .UniqueResult<Subscriber>();
        }

        #endregion
    }
}